<%--
  Created by IntelliJ IDEA.
  User: ren jian
  Date: 2021/12/25
  Time: 8:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<base href="http://localhost:8080/OnlineBook/">
<html>
<head>
    <title>登录界面</title>
</head>
    <script type="text/javascript">
      window.onload=function(){
        var btnObj=document.getElementById("btn");
        btnObj.onclick=function () {
              var isChecked = document.getElementById("remember").checked;
              if (isChecked){
                document.getElementById("remember").value=1;
              }
              if (isChecked==false){
                document.getElementById("remember").value=0;
              }
        }
      }

</script>

  <body>
  <div>${requestScope.msg}</div>
  <form method="post" action="loginServlet?action=login">
  <table>
    <tr>

     <td> 用户名：</td>
      <td><input name="username" type="text" value="${empty cookie.username?requestScope.username:cookie.username.value}" ></td>
    </tr>

    <tr>
      <td>
        密 码 :
      </td>
      <td>
        <input name="password" type="password" value="${empty cookie.password?"":cookie.password.value}" >
      </td>
    </tr>

    <tr>
      <td>验证码：</td>
      <td>   <input type="text" value="abcd" name="code"><br></td>
    </tr>

    <tr>
      <td><input type="checkbox" value=1 id="remember" checked="checked" name="save"/>记住密码</td>
    </tr>

    <tr>
      <td>
        <input type="submit" value="登录" id="btn">
      </td>
    </tr>

  </table>
  </form>
  <hr>
  <a href="regist.jsp">还没有账号? 立即注册</a>
  </body>
</html>
